﻿function redirectToAction(module, action,param) {
    var url = '/' + module + '/' + action + '/';
    if (param!=null) {
        url += param;
    }
    window.location.replace(url);
}

function refresh() {
    window.location.replace(window.location);   //TODO: replace this function
}

function initializeButtons() {
    $(":button").addClass("ui-state-default ui-corner-all").hover(
    function() { $(this).addClass('ui-state-hover'); },
    function() { $(this).removeClass('ui-state-hover'); }
    );
    $(":submit").addClass("ui-state-default ui-corner-all").hover(
    function() { $(this).addClass('ui-state-hover'); },
    function() { $(this).removeClass('ui-state-hover'); }
    );
}

function customizeSuperfish() {
    $(".sf-menu li").hover(
    function() { $(this).addClass('ui-state-hover'); },
    function() { $(this).removeClass('ui-state-hover'); }
    );
}

function clearFormFields(formname) {

    $(formname).find(':input').each(function() {
        switch (this.type) {
            case 'password':
            case 'select-multiple':
            case 'select-one':
            case 'text':
            case 'textarea':
                $(this).val('');
                break;
            case 'checkbox':
            case 'radio':
                this.checked = false;
                break;
        }
    });
}

